Conversation
Introduce a root vitest.config.ts and split package test configs into unit and browser projects (packages/common/vitest.unit.config.ts, packages/common/vitest.browser.config.ts). Remove the old combined common vitest config and migrate per-package coverage/test settings into the central config. Update package.json scripts to run Vitest from the repo root, remove per-package Vitest deps where appropriate, and add browser/playwright-related devDeps at the root. Adjust tsconfigs (add root tsconfig.json and include vitest.*.config.ts in packages/common) and simplify turbo.json task entries. Also add a README link to the Vitest VS Code extension.
Replace the brief Test-driven development note with an expanded TDD section that explains how to run tests, test file locations, and filtering by test name. Add subsections on test structure, type testing (expectTypeOf), and inline snapshot usage with Vitest code examples. Remove the previous Vitest filtering CLI snippets and some commit-message examples to streamline the guidance and surface more actionable testing patterns for contributors.
Rename vitest.config.ts → vitest.config.mts (switch to .mts/ESM), update tsconfig include to reference vitest.config.mts, and add a new "scripts" test project in the Vitest config to include tests matching scripts/**/*.test.mts. Also simplify package.json "verify" script by removing the generic "pnpm test" step.
Introduce a standalone createQueryBuilder(Schema) to build typed Kysely queries without an Evolu instance. The createQuery implementation was moved into packages/common/src/local-first/Schema.ts and exported from index.ts; Evolu.createQuery was removed from the Evolu interface/instance. Updated usages across playgrounds to call createQuery(...) (created via createQueryBuilder) and adjusted types/docs in Query.ts. Added a changeset noting the API migration and guidance to replace evolu.createQuery with createQueryBuilder(Schema).
…mentation and configuration schema.
📝 WalkthroughWalkthroughAdds a standalone Changes
Sequence Diagram(s)sequenceDiagram
participant App as Example App
participant QBFactory as createQueryBuilder(Schema)
participant Compiler as Query Compiler
participant DB as Database
App->>QBFactory: createQueryBuilder(Schema) [once]
QBFactory->>QBFactory: return createQuery function
rect rgba(100, 200, 150, 0.5)
Note over App,Compiler: Old Pattern (instance-bound)
App->>App: evolu.createQuery((db) => db.selectFrom(todos))
App->>Compiler: compile query
Compiler->>DB: execute
end
rect rgba(150, 150, 200, 0.5)
Note over App,QBFactory: New Pattern (standalone, reusable)
App->>QBFactory: const todosQuery = createQuery((db) => db.selectFrom(todos))
QBFactory->>Compiler: compile query
Compiler->>DB: execute
App->>QBFactory: const projectsQuery = createQuery((db) => db.selectFrom(projects))
QBFactory->>Compiler: compile query
Compiler->>DB: execute
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Pull request overview
This PR cherry-picks changes from the upstream common-v8 branch, implementing a major refactoring of the testing infrastructure and introducing a breaking API change for query creation.
Changes:
- Centralized Vitest configuration at the repository root with workspace support, removing package-level test scripts
- Introduced
createQueryBuilderas a standalone function, replacing theevolu.createQuerymethod (breaking change) - Updated dependencies including Biome (2.3.14), Kysely (0.28.11), Turbo (2.8.3), and various React type definitions
Reviewed changes
Copilot reviewed 40 out of 42 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.mts | New root-level Vitest workspace configuration |
| tsconfig.json | New root TypeScript config for vitest.config.mts |
| turbo.json | Removed test-related tasks (now handled by root vitest) |
| package.json | Centralized test commands to use vitest directly |
| packages/common/vitest.*.config.ts | Split vitest config into separate unit and browser configs |
| packages/common/src/local-first/Schema.ts | Added createQueryBuilder function |
| packages/common/src/local-first/Evolu.ts | Removed createQuery method from Evolu interface |
| packages/common/src/index.ts | Exported createQueryBuilder |
| packages/*/vitest.config.ts | Changed from defineConfig to defineProject |
| packages/*/package.json | Removed test scripts, updated dependencies |
| apps/web playgrounds | Updated to use createQueryBuilder (partial) |
| .changeset/create-query-builder.md | Major version changeset for breaking API change |
apps/web/src/app/(playgrounds)/playgrounds/minimal/EvoluMinimalExample.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Miccy <code@miccy.dev>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Miccy <code@miccy.dev>
* Initial plan * Revert EvoluMinimalExample.tsx to working state from 13fab62 Co-authored-by: miccy <9729864+miccy@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
* Initial plan * Update all examples to use createQueryBuilder instead of evolu.createQuery Co-authored-by: miccy <9729864+miccy@users.noreply.github.com> * Fix CI: add build:docs before typedoc-plugin tests in verify script Co-authored-by: miccy <9729864+miccy@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
Signed-off-by: Miccy <support@miccy.dev>
…n tests in the verify script.
… local constant for current schema.
Description
Type of Change
Checklist
bun run check)Related Issues
Summary by CodeRabbit
New Features
Breaking Changes
Documentation
Chores